package org.eyeTopLight.po;

import lombok.Data;
import org.eyeTopLight.constant.ConstantUtil;
import org.eyeTopLight.po.initEntity.Goods;

import java.text.SimpleDateFormat;
import java.util.Date;

@Data
public class LenGoods implements Goods {
    private Integer lenGoods_id;
    private Date lenGoods_updateDate;
    private String lenGoods_name;
    private String lenGoods_category;
    private String lenGoods_imageUrl;
    private String lenGoods_price;
    private String lenGoods_store;
    private String lenGoods_onShelf;
    private Integer lenGoods_imageCount;


    @Override
    public String getImageUrlAtIndex(Integer index){
        String[] imageUrls = lenGoods_imageUrl.split(ConstantUtil.SEPARATOR_SYMBOL);
        if(imageUrls == null || index >= imageUrls.length){
            return null;
        }
        return imageUrls[index];
    }

    @Override
    public String getSymbol() {
        return "len";
    }

    @Override
    public String getGoods_updateDate() {
        SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");
        String dateTime = formatter.format(getLenGoods_updateDate());
        return dateTime;
    }

    @Override
    public String getGoods_imageUrl() {
        return getLenGoods_imageUrl();
    }
}
